package com.cynoware.busappmas.ui;

import java.lang.reflect.Method;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.util.Log;


@SuppressLint("UseValueOf")
public class Distribution  {
	
	private static final String TAG = "Distribution";
	public static int MODE_0 = 0;
	public static int MODE_1 = 1;
	public static int MODE_2 = 2;
	public static int MODE_3 = 3;
	
	/*
	 * refer to 1440
	 */
	public static double width_ = 1440.0;
	public static double height_ = 900.0;
	
	//mode0 -- word
	public static double videoHeight_mode0 = 820.0;
	
	//mode1 -- 4 picture and word
	public static double videoWidth_mode1 = 1120.0;
	public static double  marqueeHeight = 70.0;
	public static double timeWidth_mode1 = width_ - videoWidth_mode1;
	public static double timeHeight_mode1 = 60;
	public static double timePLeft_mode1 = 15.0;
	public static double timePTop_mode1 = 5.0 ;
	public static double imgWidth_mode1 = timeWidth_mode1;
	public static double imgHeight_mode1 = (width_ - timeHeight_mode1)/4;
	public static int imageNum = 4;
	
	//mode2 -- 2 picture and word
	public static double videoWidth_mode2 = videoWidth_mode1;
	public static double videoHeight_mode2 = 800.0;
	public static double videoLeft_mode2 = 10.0;
	public static double videoTop_mode2 = 8.0;	
	public static double imageWidth_mode2 = timeWidth_mode1;
	public static double image1Heightmode2 = 515.0;
	public static double imageLeft_mode2 = 6.0;
	public static double imageTop_mode2 = videoTop_mode2;
	public static double marqueeLeft_mode2 = 165.0;
	public static double marqueeTop_mode2 = 25.0;
	
	//word size
	public static double marqueeSize = 40.0;
	public final static double marqueeSize_lvzhou = 65.0;
	
	//login progress bar
	public static double  LProWidth = 305.0;
	public static double  LProHeight = 22.0;
	public static double  LProMarginTop = 615.0;
	public static double  LProMarginLeft = 575.0;
	
    //screen special handle
	public static int screen_700_506_19_bottom = 20;
	public static int screen_700_506_19_left = 20;
	
	
	public static int getModelVideoWidth(int width,int mode){	
		double ratio = 0;
		double videoWidthD = 0;
		int videoWidthI = 0;
		
		if (mode == MODE_1){
			ratio = videoWidth_mode1/width_;				
		}else if (mode == MODE_2){
			ratio = videoWidth_mode2/width_;		
		}
		videoWidthD = width*ratio;
		videoWidthI = (new   Double(videoWidthD)).intValue();		
		return videoWidthI;		
	}
	
	public static int getModelVideoHeight(int height,int mode){	
		double ratio = 0;
		double heightD = 0;
		int heightI = 0;
		
		if (mode == MODE_0){
			ratio = videoHeight_mode0/height_;
		}else if (mode == MODE_2){
			ratio = videoHeight_mode2/height_;		
		}
		heightD = height*ratio;
		heightI = (new   Double(heightD)).intValue();		
		return heightI;		
	}
	
	public static int getModelVideoLeft(int width,int mode){	
		double ratio = 0;
		double leftD = 0;
		int leftI = 0;
		
		if (mode == MODE_2){
			ratio = videoLeft_mode2/width_;		
		}
		leftD = width*ratio;
		leftI = (new   Double(leftD)).intValue();		
		return leftI;		
	}
	
	public static int getModelVideoTop(int height,int mode){	
		double ratio = 0;
		double topD = 0;
		int topI = 0;
		
		if (mode == MODE_2){
			ratio = videoTop_mode2/height_;		
		}
		topD = height*ratio;
		topI = (new   Double(topD)).intValue();		
		return topI;		
	}
	
	
	public static int getMarqueeHeight(int height,int mode){	
		double ratio ;
		double heightD = 0;
		int heightRet = 0;
		if (mode == MODE_1){
			ratio = marqueeHeight/height_;	
			heightD = height*ratio;	
		}
		heightRet = (new   Double(heightD)).intValue();
		return heightRet;		
	}
	
	public static int getModelMarqueeLeft(int width,int mode){	
		double ratio = 0;
		double leftD = 0;
		int leftI = 0;
		
		if (mode == MODE_2){
			ratio = marqueeLeft_mode2/width_;		
		}
		leftD = width*ratio;
		leftI = (new   Double(leftD)).intValue();		
		return leftI;		
	}
	
	public static int getModelMarqueeRight(int width){
		double ratio = 0;
		double rightD = 0;
		int rightI = 0;
		
		ratio = timeWidth_mode1/width_ ;
		rightD = width*ratio;
		rightI = (new   Double(rightD)).intValue();			
		return rightI;	
	}
	
	public static int getModelMarqueeTop(int height,int mode){	
		double ratio = 0;
		double topD = 0;
		int topI = 0;
		
		if (mode == MODE_2){
			ratio = marqueeTop_mode2/height_;		
		}
		topD = height*ratio;
		topI = (new   Double(topD)).intValue();		
		return topI;		
	}
	
	public static int getModelTimeWidth(int width,int mode){	
		int videoWidth ;
		int timeWidth = 0;
		if (mode == MODE_1){
			videoWidth = getModelVideoWidth(width,mode);
			timeWidth = width - videoWidth;
		}
				
		return timeWidth;		
	}
	
	public static int getModelTimeHeight(int height,int mode){
		double ratio;
		double timeHeightD = 0;
		int videoWidthI = 0;
		if (mode == MODE_1){
			ratio = timeHeight_mode1/height_;	
			timeHeightD = height*ratio;		
		}
		videoWidthI = (new   Double(timeHeightD)).intValue();	
		return videoWidthI;	
	}
	
	public static int getModelTimePLeft(int width,int mode){	
		double ratio = 0;
		double timeLeftD = 0;
		int timeLeftI = 0;
		if (mode == MODE_1){
			ratio = timePLeft_mode1/width_;	
		}
		timeLeftD = width*ratio;		
		timeLeftI = (new   Double(timeLeftD)).intValue();	
		return timeLeftI;		
	}
	
	public static int getModelTimePTop(int height,int mode){
		double ratio = 0;
		double timeTopD = 0;
		int timeTopI = 0;
		if (mode == MODE_1){
			ratio = timePTop_mode1/height_;		
		}
		timeTopD = height*ratio;
		timeTopI = (new   Double(timeTopD)).intValue();	
		return timeTopI;	
	}
	
	public static int getModelImageWidth(int width,int mode){
		
		double ratio = 0;
		double widthD = 0;
		int widthI = 0;
		
		if (mode == MODE_2){
			ratio = imageWidth_mode2/width_;
		}
		widthD = ratio*width;
		widthI = (new   Double(widthD)).intValue();	
		return widthI;
	}
	
	public static int getModelImageHeight(int height,int mode){
		int timeHeight = 0;
		int imageHeight = 0;
		if (mode == MODE_1){
			timeHeight = getModelTimeHeight(height,mode);
			imageHeight = (height - timeHeight)/imageNum;
		}
		return imageHeight;
	}
	
	public static int getModelImage1Height(int height,int mode){
		double ratio = 0;
		double heightD = 0;
		int heightI = 0;
		if (mode == MODE_2){
			ratio = image1Heightmode2/height_;
		}
		heightD = ratio*height;
		heightI = (new   Double(heightD)).intValue();
		return heightI;
	}
	
	public static int getModelImageMarginLeft(int width,int mode){
		double ratio = 0;
		double widthD = 0;
		int widthI = 0;
		if (mode == MODE_2){
			ratio = imageLeft_mode2/width_;
		}
		widthD = ratio*width;
		widthI = (new   Double(widthD)).intValue();
		return widthI;
	}
	
	public static int getMarqueeSize(int height){	
		double ratio = 0;
		double topD = 0;
		int topI = 0;
		ratio = marqueeSize/height_;		
		topD = height*ratio;
		topI = (new   Double(topD)).intValue();		
		return topI;		
	}
	
	//login progress bar	
	public static int getLProWidth(int width){		
		double ratio = 0;
		double topD = 0;
		int topI = 0;
		
		ratio = LProWidth/width_;		
		topD = width*ratio;
		topI = (new   Double(topD)).intValue();		
		return topI;
	}
	
	public static int getLProHeight(int height){
		double ratio = 0;
		double topD = 0;
		int topI = 0;
		
		ratio = LProHeight/height_;		
		topD = height*ratio;
		topI = (new   Double(topD)).intValue();		
		return topI;
	}
	
	public static int getLProMarginLeft(int width){
		double ratio = 0;
		double topD = 0;
		int topI = 0;
		
		ratio = LProMarginLeft/width_;		
		topD = width*ratio;
		topI = (new   Double(topD)).intValue();		
		return topI;
	}
	
	public static int getLProMarginTop(int height){
		double ratio = 0;
		double topD = 0;
		int topI = 0;
		
		ratio = LProMarginTop/height_;		
		topD = height*ratio;
		topI = (new   Double(topD)).intValue();		
		return topI;
	}
	
	public static int getTopTimeSize(int oriSize,int width){
		
		double ratio = 0;
		double topD = 0;
		int topI = 0;
		
		ratio = oriSize/width_;	
		topD = width*ratio;
		topI = (new   Double(topD)).intValue();		
		return topI;
	}
	
	
	public static float getScreenWRatio(int width){
		return (float) (width/width_);
	}
	
	public static float getScreenHRatio(int height){
		return (float) (height/height_);
	}
	

}
